/*
 *  hihocoder.com
 *
 *  Category: Greed
 */

/*-------- Includes --------*/
#include <iostream>

using namespace std;

/*-------- Defines --------*/


/*-------- Types --------*/


/*-------- Global Variables --------*/
int N, M, K;
int A[100002];
int B[100002];

/*-------- Function Prototypes --------*/


/*-------- Main Function --------*/
int main(int argc, char const *argv[])
{
    int nCase;

    cin >> nCase;

    while (nCase--) {
        cin >> N >> M >> K;

        for (int i = 0; i < M; ++i) {
            cin >> A[i] >> B[i];

            if (i > 0) B[i] += B[i-1];
        }

        bool isbreak = false;
        int  start   = 0;
        int  sday    = 0;
        for (int i = 0; i < M; ++i) {
            int sum = B[i];     // days for review

            int day = (A[i] - start) / K;   // days for rest from start to A[i]

            start += day * K;
            sday  += day;

            if (start == A[i]) --start;

            sum += sday;    // days for rest from 0 to A[i]
            sum += i + 1;   // days for examination

            if (sum > A[i]) {
                cout << "NO" << endl;
                isbreak = true;
                break;
            }
        }

        if (isbreak) continue;

        cout << "YES" << endl;
    }

    return 0;
}

/*-------- Functions --------*/

